#include <bits/stdc++.h>
using namespace std;

const double eps = 1e-8;

struct node {
    int d, v, a;
    void read() {
        cin >> d >> v >> a;
    }
} c[100005];

struct ar {
    int l = 0, r = 0;
};

int fst[1000005];
bool vis[100005];

bool cmp(ar x, ar y) {
    if (x.r != y.r) return x.r < y.r;
    return x.l < y.l;
}

void work() {
    int n, m, L, V, mnt[100005] = {0};
    memset(vis, false, sizeof vis);
    cin >> n >> m >> L >> V;
    bool A = true, B = true, C = true;
    for (int i = 1; i <= n; i++) {
        c[i].read();
        if (c[i].a != 0) A = false;
        if (c[i].a <= 0) B = false;
        if (c[i].a >= 0) C = false;
    }
    for (int i = 1; i <= m; i++)
        cin >> mnt[i];
    int ans1 = 0, ans2 = 0;
    if (A) { // 20 pts
        for (int i = 1; i <= n; i++)
            if (c[i].v > V && c[i].d <= mnt[m]) ans1++;
        ans2 = m - 1;
    } else if (B) { // 20 pts
        for (int i = 1; i <= n; i++) {
            int vi = c[i].v * c[i].v + 2 * c[i].a * (mnt[m] - c[i].d);
            if (vi > V * V && c[i].d <= mnt[m]) ans1++;
        }
        ans2 = m - 1;
    } else if (C) { // 0 pts
        int k = 0;
        for (int i = 1; i <= L; i++) {
            fst[i] = fst[i - 1];
            if (mnt[k + 1] == i)
                k++, fst[i] = k;
        }
        k = 0;
        ar q[100005];
        for (int i = 1; i <= n; i++) {
            if (c[i].v <= V) continue;
            double t = -1.0 * c[i].v / c[i].a + eps;
            double s = c[i].v * t + c[i].a * t * t / 2 + eps;
            int l = 1e9, r = -1e9;
            bool flag = false;
            for (int j = 0; j <= int(s); j++) {
                int now = c[i].d + j;
                int vj = c[i].v * c[i].v + 2 * c[i].a * j;
                if (vj > V * V && fst[now] != fst[now - 1]) {
                    if (!flag) ans1++, flag = true;
                    if (vis[fst[now]] == false) {
                        l = min(l, fst[now]);
                        r = max(r, fst[now]);
                    }
                    //break;
                } else if (vj <= V * V) {
                    break;
                }
            }
            if (l != 1e9 && r != -1e9) {
                k++;
                q[k].l = l, q[k].r = r;
            }
        }
        sort(q + 1, q + k + 1, cmp);
        int tmp = q[1].r;
        for (int i = 2; i <= k; i++) {
            if (q[i].l > tmp) {
                ans2++;
                //cerr << tmp << '\n';
                tmp = q[i].r;
            }
        }
    } else {
        puts("Never Gonna Give You Up!");
    }
    if (ans1 == 0) ans2 = m;
    cout << ans1 << ' ' << ans2 << '\n';
}

signed main() {
    freopen("detect.in", "r", stdin);
    freopen("detect.out", "w", stdout);
    int T = 0;
    cin >> T;
    while (T--) {
        work();
    }
    return 0;
}
//40 pts ?
